🎖️GitЯра🎖️
Node / meshtastic / Meshtastic-Android / files / core / repository / src / commonMain / kotlin / org / meshtastic / core / repository / CommandSender.kt
Displaying Raw • Download
core/repository/src/commonMain/kotlin/org/meshtastic/core/repository/CommandSender.kt 4d4070c8e1ed73a56ee2f054300a0f62e3fe2e62 (4d4070c8) Text, 7.04 KB
T8b949e/*
* Copyright (c) 2026 Meshtastic LLC
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
Tff7b72package T7ee787org.meshtastic.core.repository
Tff7b72import T7ee787org.meshtastic.core.model.DataPacket
Tff7b72import T7ee787org.meshtastic.proto.AdminMessage
Tff7b72import T7ee787org.meshtastic.proto.ChannelSet
Tff7b72import T7ee787org.meshtastic.proto.LocalConfig
Tff7b72import T7ee787org.meshtastic.core.model.Position Tff7b72as Te6edf3ModelPosition
Tff7b72import T7ee787org.meshtastic.proto.Position Tff7b72as Te6edf3ProtoPosition
T8b949e/** Interface for sending commands and packets to the mesh network. */
Tf0883e@SuppressTb4b4b4(Ta5d6ff"Ta5d6ffTooManyFunctionsTa5d6ff"Tb4b4b4)
Tff7b72interface T56d364CommandSender Tb4b4b4{
T8b949e/** Returns the current packet ID. */
Tff7b72fun Td2a8ffgetCurrentPacketIdTb4b4b4(Tb4b4b4)Tb4b4b4: Tffa657Long
T8b949e/** Returns the cached local configuration. */
Tff7b72fun Td2a8ffgetCachedLocalConfigTb4b4b4(Tb4b4b4)Tb4b4b4: Te6edf3LocalConfig
T8b949e/** Returns the cached channel set. */
Tff7b72fun Td2a8ffgetCachedChannelSetTb4b4b4(Tb4b4b4)Tb4b4b4: Te6edf3ChannelSet
T8b949e/** Generates a new unique packet ID. */
Tff7b72fun Td2a8ffgeneratePacketIdTb4b4b4(Tb4b4b4)Tb4b4b4: Tffa657Int
T8b949e/**
* Sends a data packet to the mesh. If the outbound queue refuses admission, the packet is marked
* [org.meshtastic.core.model.MessageStatus.ERROR] and [PacketQueueRejectedException] is thrown so the persistence
* owner can requeue or fail its durable record instead of treating a normal return as successful admission.
*/
Tff7b72suspend Tff7b72fun Td2a8ffsendDataTb4b4b4(Te6edf3pTb4b4b4: Te6edf3DataPacketTb4b4b4)
T8b949e/** Sends an admin message to a specific node, or throws if the outbound queue rejects it. */
Tff7b72suspend Tff7b72fun Td2a8ffsendAdminTb4b4b4(
Te6edf3destNumTb4b4b4: Tffa657IntTb4b4b4,
Te6edf3requestIdTb4b4b4: Tffa657Int Tff7b72= Te6edf3generatePacketIdTb4b4b4(Tb4b4b4)Tb4b4b4,
Te6edf3wantResponseTb4b4b4: Tffa657Boolean Tff7b72= Tff7b72falseTb4b4b4,
Te6edf3initFnTb4b4b4: Tb4b4b4(Tb4b4b4) Tff7b72-Tff7b72> Te6edf3AdminMessageTb4b4b4,
Tb4b4b4)
T8b949e/**
* Sends an admin message only if [expectedConnectionVersion] still owns queue admission.
*
* Pass the `version` from [ConnectionStateProvider.connectionLifecycle] captured by the caller.
*
* @throws PacketQueueRejectedException when the expected version is stale or the outbound queue otherwise refuses
* the command.
*/
Tff7b72suspend Tff7b72fun Td2a8ffsendAdminForConnectionTb4b4b4(
Te6edf3destNumTb4b4b4: Tffa657IntTb4b4b4,
Te6edf3expectedConnectionVersionTb4b4b4: Tffa657LongTb4b4b4,
Te6edf3requestIdTb4b4b4: Tffa657Int Tff7b72= Te6edf3generatePacketIdTb4b4b4(Tb4b4b4)Tb4b4b4,
Te6edf3wantResponseTb4b4b4: Tffa657Boolean Tff7b72= Tff7b72falseTb4b4b4,
Te6edf3initFnTb4b4b4: Tb4b4b4(Tb4b4b4) Tff7b72-Tff7b72> Te6edf3AdminMessageTb4b4b4,
Tb4b4b4)
T8b949e/**
* Sends an admin message immediately, bypassing the outbound packet queue. The queue only drains while the
* connection state is Connected, so mid-handshake sends (e.g. set_time_only at MyNodeInfo) must use this path or
* they stall until the handshake finishes.
*/
Tff7b72fun Td2a8ffsendAdminImmediateTb4b4b4(Te6edf3destNumTb4b4b4: Tffa657IntTb4b4b4, Te6edf3initFnTb4b4b4: Tb4b4b4(Tb4b4b4) Tff7b72-Tff7b72> Te6edf3AdminMessageTb4b4b4)
T8b949e/**
* Sends an admin message and suspends until firmware processes it and returns a routing acknowledgement.
*
* This is used when the caller needs a processing barrier before proceeding, such as sending a shared contact
* before the first DM to a node. Time spent behind existing FIFO entries does not count against the
* routing-response timeout; the timeout starts only after an active transport admits this packet.
*
* @return `true` on a routing ACK or synchronous local-loopback delivery (`ERRNO_SHOULD_RELEASE`); `false` when
* disconnected, transport sending fails, a routing NAK or queue rejection arrives, or the operation times out.
*/
Tff7b72suspend Tff7b72fun Td2a8ffsendAdminAwaitTb4b4b4(
Te6edf3destNumTb4b4b4: Tffa657IntTb4b4b4,
Te6edf3requestIdTb4b4b4: Tffa657Int Tff7b72= Te6edf3generatePacketIdTb4b4b4(Tb4b4b4)Tb4b4b4,
Te6edf3wantResponseTb4b4b4: Tffa657Boolean Tff7b72= Tff7b72falseTb4b4b4,
Te6edf3initFnTb4b4b4: Tb4b4b4(Tb4b4b4) Tff7b72-Tff7b72> Te6edf3AdminMessageTb4b4b4,
Tb4b4b4)Tb4b4b4: Tffa657Boolean Tff7b72= Te6edf3sendAdminAwaitResultTb4b4b4(Te6edf3destNumTb4b4b4, Te6edf3requestIdTb4b4b4, Te6edf3wantResponseTb4b4b4, Te6edf3initFnTb4b4b4)Tb4b4b4.Te6edf3accepted
T8b949e/**
* Detailed form of [sendAdminAwait], including whether an active transport admitted the packet. Queue or transport
* rejection is represented by a non-accepted [AwaitedSendResult] with `dispatched == false`; it is not reported as
* [PacketQueueRejectedException].
*/
Tff7b72suspend Tff7b72fun Td2a8ffsendAdminAwaitResultTb4b4b4(
Te6edf3destNumTb4b4b4: Tffa657IntTb4b4b4,
Te6edf3requestIdTb4b4b4: Tffa657Int Tff7b72= Te6edf3generatePacketIdTb4b4b4(Tb4b4b4)Tb4b4b4,
Te6edf3wantResponseTb4b4b4: Tffa657Boolean Tff7b72= Tff7b72falseTb4b4b4,
Te6edf3initFnTb4b4b4: Tb4b4b4(Tb4b4b4) Tff7b72-Tff7b72> Te6edf3AdminMessageTb4b4b4,
Tb4b4b4)Tb4b4b4: Te6edf3AwaitedSendResult
T8b949e/** Sends our current position to the mesh, or throws if the outbound queue rejects it. */
Tff7b72suspend Tff7b72fun Td2a8ffsendPositionTb4b4b4(Te6edf3posTb4b4b4: Te6edf3ProtoPositionTb4b4b4, Te6edf3destNumTb4b4b4: Tffa657Int? Tff7b72= Tff7b72nullTb4b4b4, Te6edf3wantResponseTb4b4b4: Tffa657Boolean Tff7b72= Tff7b72falseTb4b4b4)
T8b949e/** Requests the position of a specific node, or throws if the outbound queue rejects it. */
Tff7b72suspend Tff7b72fun Td2a8ffrequestPositionTb4b4b4(Te6edf3destNumTb4b4b4: Tffa657IntTb4b4b4, Te6edf3currentPositionTb4b4b4: Te6edf3ModelPositionTb4b4b4)
T8b949e/** Sets a fixed position for a node, or throws if the outbound queue rejects the admin command. */
Tff7b72suspend Tff7b72fun Td2a8ffsetFixedPositionTb4b4b4(Te6edf3destNumTb4b4b4: Tffa657IntTb4b4b4, Te6edf3posTb4b4b4: Te6edf3ModelPositionTb4b4b4)
T8b949e/** Requests user info from a specific node, or throws if the outbound queue rejects it. */
Tff7b72suspend Tff7b72fun Td2a8ffrequestUserInfoTb4b4b4(Te6edf3destNumTb4b4b4: Tffa657IntTb4b4b4)
T8b949e/** Requests a traceroute to a specific node, or throws if the outbound queue rejects it. */
Tff7b72suspend Tff7b72fun Td2a8ffrequestTracerouteTb4b4b4(Te6edf3requestIdTb4b4b4: Tffa657IntTb4b4b4, Te6edf3destNumTb4b4b4: Tffa657IntTb4b4b4)
T8b949e/** Requests telemetry from a specific node, or throws if the outbound queue rejects it. */
Tff7b72suspend Tff7b72fun Td2a8ffrequestTelemetryTb4b4b4(Te6edf3requestIdTb4b4b4: Tffa657IntTb4b4b4, Te6edf3destNumTb4b4b4: Tffa657IntTb4b4b4, Te6edf3typeValueTb4b4b4: Tffa657IntTb4b4b4)
T8b949e/**
* Requests telemetry only if [expectedConnectionVersion] still owns queue admission.
*
* Pass the `version` from [ConnectionStateProvider.connectionLifecycle] captured by the caller.
*
* @throws PacketQueueRejectedException when the expected version is stale or the outbound queue otherwise refuses
* the request.
*/
Tff7b72suspend Tff7b72fun Td2a8ffrequestTelemetryForConnectionTb4b4b4(
Te6edf3requestIdTb4b4b4: Tffa657IntTb4b4b4,
Te6edf3destNumTb4b4b4: Tffa657IntTb4b4b4,
Te6edf3typeValueTb4b4b4: Tffa657IntTb4b4b4,
Te6edf3expectedConnectionVersionTb4b4b4: Tffa657LongTb4b4b4,
Tb4b4b4)
T8b949e/**
* Requests neighbor info from a specific node.
*
* @throws LocalNodeUnavailableException when the local node identity is unavailable before admission.
* @throws PacketQueueRejectedException when the outbound queue rejects the request.
*/
Tff7b72suspend Tff7b72fun Td2a8ffrequestNeighborInfoTb4b4b4(Te6edf3requestIdTb4b4b4: Tffa657IntTb4b4b4, Te6edf3destNumTb4b4b4: Tffa657IntTb4b4b4)
T8b949e/**
* Sends a lockdown passphrase to authenticate with a locked device.
*
* @param disable when `true`, instructs the device to decrypt storage back to plaintext and leave lockdown (the off
* switch). The device reboots and reconnects reporting `DISABLED`.
*/
Tff7b72fun Td2a8ffsendLockdownPassphraseTb4b4b4(
Te6edf3passphraseTb4b4b4: Tffa657StringTb4b4b4,
Te6edf3bootsTb4b4b4: Tffa657Int Tff7b72= T79c0ff0Tb4b4b4,
Te6edf3hoursTb4b4b4: Tffa657Int Tff7b72= T79c0ff0Tb4b4b4,
Te6edf3maxSessionSecondsTb4b4b4: Tffa657Int Tff7b72= T79c0ff0Tb4b4b4,
Te6edf3disableTb4b4b4: Tffa657Boolean Tff7b72= Tff7b72falseTb4b4b4,
Tb4b4b4)
T8b949e/** Sends a Lock Now command to immediately lock a locked-firmware device. */
Tff7b72fun Td2a8ffsendLockNowTb4b4b4(Tb4b4b4)
Tb4b4b4}
Served by rngit 1.5.0 - Generated in 0.19s